<template>
  <div class="newList">
    
    <ul class="meet-box">
      <li class="meet-li" v-for="(i,index) in list" @click="newsDetail(i)" :key="index">
        <div class="img">
          <div class="meet-stauts" :class="'meet-stauts'+i.status">{{i.statusText}}</div>
          <img v-if="!i.imgurl" src="./meetnull.png" alt />
          <img v-else :src="i.imgurl" alt />
        </div>
        <div class="meet-text">
          <p class="meet-name">{{i.name}} </p>
          <p class="meet-text-p dh">
            <van-icon class="icon1" :name="icon1" />
            {{i.begin_date_str}} <span style="padding:0 0.05rem">~</span> {{i.end_date_str}}
          </p>
          <p class="meet-text-p">
            <van-icon class="icon1" :name="icon2" />
            {{i.address}}
          </p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script type="text/ecmascript-6">
import dings from "../../assets/img/icon-ding.png";
import icon1 from "../../assets/img/meeting/iconri.png";
import icon2 from "../../assets/img/meeting/icondz.png";
import { formatstr } from "../../assets/js/tools";
export default {
  props: ["meetList"],
  data() {
    return {
      icon1,
      icon2
    };
  },
  computed: {
    list() {
      var nowtime = new Date().getTime();
      for (let index = 0; index < this.meetList.length; index++) {
        const element = this.meetList[index];
        // element.begin_date_str = formatstr(element.begin_date);
        // element.end_date_str = formatstr(element.end_date);
        element.begin_date_str =  element.begin_date ;
        element.end_date_str = element.end_date ;
        var starttrap = new Date(element.begin_date).getTime();
        var endTime = new Date(element.end_date).getTime();
        if (nowtime > endTime) {
          element.status = 2; //过期
          element.statusText = "Overdue";
        } else if (nowtime < endTime && nowtime > starttrap) {
          element.status = 0; //进行中
          element.statusText = "Underway";
        } else if (nowtime < starttrap) {
          element.status = 1; //未开始
          element.statusText = "Not Started";
        }
      }
      return this.meetList;
    }
  },
  created() {},
  methods: {
    newsDetail(i) {
      this.$router.push({ path: "meetDetails", query: i });
    }
  }
};
</script>

<style scoped lang="less">
.newList {
  background: #ffffff;
  margin-bottom: 0.2rem;
}
.newList-title {
  padding: 0 0.3rem;
  height: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  display: none;
  .line {
    display: block;
    width: 0.08rem;
    height: 0.32rem;
    background: rgba(228, 157, 53, 1);
    border-radius: 5px;
    margin-right: 0.2rem;
  }
  .newList-title-p1 {
    display: flex;
    align-items: center;
    font-size: 0.36rem;
    font-weight: bold;
    color: rgba(21, 23, 35, 1);
  }
}
.meet-box {
  padding: 0.3rem 0.3rem 0.3rem;
  .meet-li {
    padding: 0 0 0.3rem;
    margin-bottom: 0.3rem;
    border-bottom: 0.02rem solid rgba(229, 229, 229, 1);
    display: flex;

    .img {
      width: 2.28rem;
      height: 1.88rem;
      border-radius: 0.2rem;
      overflow: hidden;
      margin-right: 0.28rem;
      position: relative;
      img {
        height: 100%;
      }
    }
    .meet-stauts {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 0.5rem;
      line-height: 0.5rem;
      text-align: center;
      background: linear-gradient(
        270deg,
        rgba(238, 89, 79, 0) 0%,
        rgba(216, 45, 39, 1) 100%
      );
      font-size: 0.24rem;
      color: rgba(255, 255, 255, 1);
      opacity: 0.8;
      border-radius: 0.04rem;
      &.meet-stauts1 {
        background: linear-gradient(
          270deg,
          rgba(228, 152, 41, 0) 0%,
          #042fff 100%
        );
      }
      &.meet-stauts2 {
        background: linear-gradient(
          270deg,
          rgba(228, 152, 41, 0) 0%,
          rgba(228, 152, 41, 1) 100%
        );
      }
    }
    .meet-text {
      position: relative;
      width: 4.38rem;
    }
    .meet-name {
      height: 0.8rem;
      font-size: 0.28rem;
      margin-bottom: 0.2rem;
      line-height: 1.5;
      color: rgba(43, 43, 43, 1);
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    .meet-text-p {
      // height: 0.34rem;
      // font-size: 0.24rem;
      // line-height: 0.34rem;
      // display: flex;
      // align-items: center;

      // color: rgba(140, 138, 151, 1);
      margin-bottom: 0.1rem;
      font-size: 12px;
      line-height: 18px;
      position: relative;
      padding:0 0 0 18px;
    }
    .icon1 {
      font-size: 14px;
      position: absolute;
      left: 0;
      top: 2px
       
    }
  }
  .btn-router {
    width: 1.8rem;
    height: 0.7rem;
    line-height: 0.66rem;
    background: #fcf4e9;
    border: 0.02rem solid #e49829;
    border-radius: 0.08rem;
    color: #e49829;
    text-align: center;
    position: absolute;
    right: 0;
    top: 0.04rem;
  }
}
</style>
